package com.xuxin.pda.utils;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by xu_xin
 * Created on 2020.08.01 0001
 */
public class RecycleUtils {

    public static void init(RecyclerView view) {
        view.setLayoutManager(new LinearLayoutManager(view.getContext()));
        view.setItemViewCacheSize(20);
        view.setNestedScrollingEnabled(false);
    }

    public static void init(RecyclerView view, int num) {
        view.setLayoutManager(new GridLayoutManager(view.getContext(), num));
        view.setItemViewCacheSize(20);
        view.setNestedScrollingEnabled(false);
    }

    public static void horizontal(RecyclerView view) {
        LinearLayoutManager manager = new LinearLayoutManager(view.getContext());
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        view.setLayoutManager(manager);
        view.setItemViewCacheSize(20);
        view.setNestedScrollingEnabled(false);
    }
}